var express = require('express');
var router = express.Router();
var Recommend = require("../models/recommend");


//获取推荐
router.get('/', function(req, res, next) {
    let page = parseInt(req.param("searchNum"));
    let pageSize = 1;
    // let sort = req.param("sort");
    let skip = (page-1)*pageSize;

    var model = Recommend.find().skip(skip).limit(pageSize);
    model.exec(function(err,result){
        if(err){
            res.json({
                status:"1",
                msg:err.message
            })
        }else{
            res.json({
                status:"0",
                msg:"",
                result:{
                    count:result.length,
                    list:result
                }
            })
        }
    });
});



module.exports = router;
